package com.example.jbmsuppliers.sinopec.internet;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.view.View;

import com.example.jbmsuppliers.sinopec.view.DoubleButtonDialog;

/**
 * Created by 家帮忙 on 2017/2/14.
 */

public class UtlisBroadCastRe extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        ConnectivityManager connectivityManager= (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo info = connectivityManager.getActiveNetworkInfo();
        if (info==null){
            final DoubleButtonDialog dialog = new DoubleButtonDialog(
                    context, "未连接网络,请检查网络后重试...");
            dialog.getokbtn().setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    dialog.dismiss();

                }
            });
            dialog.setisVisibility();
        }

    }
}
